#!/bin/sh
cd `dirname $0`
pwd

pull_sub_source ()
{
	if [[ $1 == '' ]]; then
		if [[ $text_withoutblack == '' ]]; then
			return
		fi
	fi

	echo $1
	ext_source_path=`echo $1 | awk  '{print $1}'`
	if [[ -d $ext_source_path ]]; then
		cd $ext_source_path
		pull_source
		cd ..
	fi
}

pull_source()
{
	current_branch=`git branch | grep "*" | awk '{print $2}'`
	echo current branch is $current_branch
	git pull --rebase origin $current_branch
}

pull_source
cat external_sources | while read line
do
	if [[ -n $line ]]; then
		pull_sub_source "${line}"
	fi
done
pod update --verbose --no-repo-update
